// https://juejin.im/post/5dfd9d27e51d455825129ec3?utm_source=gold_browser_extension
// 过滤数组得到新数组
// wizards ===> ['Harry Potter', ]
var arr = [
  {
    name: 'Harry Potter',
    house: 'Gryfindor'
  },
  {
    name: 'Cedric Diggory',
    house: 'Hufflepuff'
  },
  {
    name: 'Tonks',
    house: 'Hufflepuff'
  },
];
var a = arr.reduce((newArr, cur) => {
  if (cur.house === 'Hufflepuff') {
    newArr.push(cur.name)
  }
  return newArr
}, [])


const arr1 = ['s0', 's4', 's1', 's2', 's8', 's3']

const a111 = arr1.reduce((pre, cur) => {
  const c = Number(cur.replace('s', ''))
  return c > pre ? c : pre
}, 0)
console.log(a111)
// console.log(a)
